﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SimpleTasks.Domain.Model
{
   public class SimpleTask
   {
      private const String _nullDescriptionMessage = "Description cannot be null, empty or whitespace.";

      public SimpleTask() { }

      internal SimpleTask(String description)
      {
         Contract.Requires(!String.IsNullOrWhiteSpace(description), _nullDescriptionMessage);

         _description = description;
      }

      public virtual Guid Id { get; set; }

      private string _description;

      public virtual String Description
      {
         get { return _description; }
         set 
         {
            if (String.IsNullOrWhiteSpace(value))
            {
               throw new InvalidOperationException(_nullDescriptionMessage);
            }

            _description = value;
         }
      }
   }
}
